home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!idkit.demon.co.uk
- From: "Leslie R. Wilk" <Leslie@idkit.demon.co.uk>
- Newsgroups: comp.lang.c++
- Subject: Windows Menu problem - Help requested
- Date: Mon, 15 Apr 96 14:07:07 GMT
- Organization: Myorganisation
- Message-ID: <829577227snz@idkit.demon.co.uk>
- Reply-To: Leslie@idkit.demon.co.uk
- X-NNTP-Posting-Host: idkit.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.29
- X-Mail2News-Path: idkit.demon.co.uk
-
-
-
- The 3 Files below are a menu example from SAMS "Teach Yourself c++ in 21 days"
-
- They should create a menu titled Les Menu for Windows, with options
-
- BUT THEY DONT
-
-
- When I run the .exe I get a Dialog Box
- TODO: Place Dialog Controls here OK/CANCEL
-
-
- If anyone can please help I would be very grateful.
- Thankyou
-
-
-
- I am using Microsoft Visual C++ 2.00
-
-
-
- Contents of MENU1.RC
-
- #include <afxres.h>
- #include "MENU1.H"
-
- OPTIONS MENU LOADONCALL MOVEABLE PURE DISCARDABLE
- BEGIN
- POPUP "&File"
- BEGIN
- MENUITEM "&New",CM_FILENEW
- MENUITEM "&Open",CM_FILEOPEN
- MENUITEM "&Save",CM_FILESAVE
- MENUITEM "&Save&As",CM_FILESAVEAS
- MENUITEM SEPARATOR
- MENUITEM "E&Exit",CM_EXIT
- END
- POPUP "&Edit"
- BEGIN
- MENUITEM "&Undo",CM_EDITUNDO
- MENUITEM SEPARATOR
- MENUITEM "C&ut",CM_EDITCUT
- MENUITEM "C&opy",CM_EDITCOPY
- MENUITEM "&Paste",CM_EDITPASTE
- POPUP "&Delete"
- BEGIN
- MENUITEM "&Line", CM_EDITDELETE
- MENUITEM "&Block", CM_EDITDELETE_BLOCK
- END
- MENUITEM "&Clear", CM_EDITCLEAR
- END
- MENUITEM "Help", CM_HELP
- END
-
-
-
- Contents of MENU1.H
-
-
-
- #define CM_FILENEW (WM_USER + 100)
- #define CM_FILEOPEN (WM_USER + 101)
- #define CM_FILESAVE (WM_USER + 102)
- #define CM_FILESAVEAS (WM_USER + 103)
- #define CM_EXIT (WM_USER + 104)
- #define CM_EDITUNDO (WM_USER + 105)
- #define CM_EDITCUT (WM_USER + 106)
- #define CM_EDITCOPY (WM_USER + 107)
- #define CM_EDITPASTE (WM_USER + 108)
- #define CM_EDITDELETE (WM_USER + 109)
- #define CM_EDITDELETE_BLOCK (WM_USER + 110)
- #define CM_EDITCLEAR (WM_USER + 111)
- #define CM_HELP (WM_USER + 112)
-
-
-
-
-
-
- Contents of MENU1.CPP
-
-
-
- #include <afxwin.h>
- #include "menu1.h"
-
- class CAppWindow : public CFrameWnd
- {
- public:
- CAppWindow ()
- { Create(NULL, " Les Menu for Windows ",
- WS_OVERLAPPEDWINDOW, rectDefault, NULL, "OPTIONS");}
- protected:
-
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
-
- afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
-
- afx_msg void OnExit();
-
-
- DECLARE_MESSAGE_MAP()
-
- };
-
- class CWindowApp : public CWinApp
- {
- public:
- virtual BOOL InitInstance();
- };
-
- void CAppWindow::OnLButtonDown(UINT nFlags, CPoint point)
- {
- MessageBox("You clicked the left button!",
- "mouse Click Event!",MB_OK);
- }
-
- void CAppWindow::OnRButtonDown(UINT nFlags,CPoint point)
- {
- MessageBeep(0);
- if (MessageBox("Want to close this application", "Query",
- MB_YESNO | MB_ICONQUESTION) == IDYES)
- SendMessage(WM_CLOSE);
- }
-
- void CAppWindow::OnExit()
- { SendMessage(WM_CLOSE);}
-
- BEGIN_MESSAGE_MAP (CAppWindow, CFrameWnd)
- ON_WM_LBUTTONDOWN()
- ON_WM_RBUTTONDOWN()
- ON_COMMAND(CM_EXIT, OnExit)
- END_MESSAGE_MAP()
-
-
- BOOL CWindowApp::InitInstance()
- {
- m_pMainWnd = new CAppWindow();
- m_pMainWnd->ShowWindow(m_nCmdShow);
- m_pMainWnd->UpdateWindow();
- return TRUE;
- }
-
-
- CWindowApp WindowApp;
-
-
-
-
-
-
-
-
- --
- Leslie R. Wilk
-